package com.lixinyue.test05;

/**
 * @program: 11.12
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-13 10:52
 **/
class Person{
    private String name;//实例成员变量
    private int age;
    private String sex;
    public Person() {
        //this调用构造函数
        this("bit", 12, "man");//必须放在第一行进行显示
    }
    //默认构造函数 构造对象
//    public Person() {
//        this.name = "caocao";
//        this.age = 10;
//        this.sex = "男";
//    }
    //带有3个参数的构造函数
    public Person(String name,int age,String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;

    }
    public void show(){
        System.out.println("name: "+name+" age: "+age+" sex: "+sex);
    }
}
public class Test {
    public static void main(String[] args) {
        Person person=new Person();
        person.show();
    }



}
